require(["common", "jQuery", "coAjax", "queryString", "hash_routie", "js/pages/admin/goods-details"], function(jSouper, $, coAjax, QueryString, hash_routie, goods_detail) {

    // 载入商品信息
    hash_routie.on("update_goods", function() {
        var queryString = new QueryString(location.hash);
        var model_id = queryString.get("id");

        var goods_to_update = App.get("$Cache.goods_to_update");
        if (goods_to_update) {
            goods_detail.init(goods_to_update)
        } else {
            console.log("model_id,", model_id);
            showLoader();
            coAjax.get(appConfig.goods.detail + queryString.get("id"), function(result) {
                goods_detail.init(result.result);
                removeLoader();
            });
        };
        $.getJSON("http://121.40.18.23:1518/api/complex/WechatClientService", {
            model_id: model_id
        }, function(wechat_result) {
            App.set("$Cache.new_goods_wechat", wechat_result);
        });
    });

    App.set("$Event.shelves.put_goods", function(e) {
        goods_detail.upload_goods("update");
    });

});
